﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Net.Sockets;

namespace client
{
    static class Program
    {
        static public Socket Serwer;
        static public Statki log;
        static public Gra giera;
        static public byte[] buforek;
        static private String ipSerwera;
        static private int portStatkow;

        static public void PolaczZSerwerem(String ip, int port)
        {
            ipSerwera = ip;
            portStatkow = port;
            PolaczZSerwerem();
        }

        static public void PolaczZSerwerem()
        {
            Program.Serwer = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream,
                System.Net.Sockets.ProtocolType.Tcp);
            Program.Serwer.Connect(ipSerwera, portStatkow);
        }

        static public void RozlaczSerwer()
        {
            Program.Serwer.Disconnect(true);
        }

        /// <summary>
        /// The main entry point for the application.
        ///
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Program.Serwer = new System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream,
                System.Net.Sockets.ProtocolType.Tcp);
            buforek = new byte[1];
            giera = new Gra();
            log = new Statki();
            Application.Run(log);
        }
   
    }


}
